package cn.fighter3.service.relationship;

import cn.fighter3.entity.relationship.Authorof1;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface AuthorcnDao extends Neo4jRepository<Authorof1,Long> {

    @Query("match (n:Cnbook),(m:People) where n.bookId=$fromId and m.authorId=$toId match (n)-[r:Authorof]->(m) delete r")
    void deleteByNodeId(String fromId,String toId);

    @Query("match (n:Cnbook),(m:People) where n.bookId=$fromId and m.authorId=$toId create (n)-[r:Authorof]->(m) return r")
    Authorof1 addAuthor(String fromId,String toId);

}
